package com.example.base.net

import com.example.base.entity.CartEntity
import com.example.base.entity.CategoryEntity
import com.example.base.entity.OrderCreateEntity
import com.example.base.entity.ProductEntity
import com.example.base.entity.Res
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface ShopApiService {
    @GET(Cons.CATEGORY_URL)
    fun category():Flow<Res<CategoryEntity>>

    @GET(Cons.PRODUCT_URL)
    fun product(@Query("limit")limit:Int,@Query("page")page:Int):Flow<Res<ProductEntity>>
    @GET(Cons.CART_URL)
    fun cart(@Query("isValid")isValid:String,@Query("limit")limit:Int,@Query("page")page:Int):Flow<Res<CartEntity>>
    @POST(Cons.CART_UPDATE_URL)
    fun cartUpdate(@Query("id")id:Int,@Query("number")number:Int):Flow<Res<String?>>
    @POST(Cons.CART_DELETE_URL)
    fun cartDelete(@Query("ids")ids:MutableList<Int>):Flow<Res<String?>>

    @POST(Cons.ORDER_CREATE_URL)
    fun orderCreate(@Body body: RequestBody):Flow<Res<OrderCreateEntity>>
}